﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace Chenxin.Lib.House.DAL
{
    /// <summary>
    /// 数据访问类House_RequestChangeInfo。
    /// </summary>
    public class House_RequestChangeInfo
    {
        public House_RequestChangeInfo()
        { }
        #region  成员方法

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public static bool Exists(Guid RecordId)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from House_RequestChangeInfo where RecordId=@RecordId ");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static void Add(Chenxin.Lib.House.Entity.House_RequestChangeInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into House_RequestChangeInfo(");
            strSql.Append("RecordId,HouseId,HouseCode,HouseAddress,ChangeType,HouseStatus,OperatorId,Operator,OprDepartId,OprDepart,CompanyId,CompanyName,RequestUserCode,RequestUserId,RequestUser,RequestDepart,RequestDepartId,Remarks,ResonRemarks,CustomerName,Mobile,Phone,confirmPersonName,confirmPersonId,Status,Addtime,DealTime,oldUserId,oldUserName,oldDepart,oldDepartId,oldCompanyId,oldCompanyName,oldCity,oldCityName,oldHouseStatus,RequestUserCity,RequestUserCityName,OprCityId,OprCityName)");

            strSql.Append(" values (");
            strSql.Append("@RecordId,@HouseId,@HouseCode,@HouseAddress,@ChangeType,@HouseStatus,@OperatorId,@Operator,@OprDepartId,@OprDepart,@CompanyId,@CompanyName,@RequestUserCode,@RequestUserId,@RequestUser,@RequestDepart,@RequestDepartId,@Remarks,@ResonRemarks,@CustomerName,@Mobile,@Phone,@confirmPersonName,@confirmPersonId,@Status,@Addtime,@DealTime,@oldUserId,@oldUserName,@oldDepart,@oldDepartId,@oldCompanyId,@oldCompanyName,@oldCity,@oldCityName,@oldHouseStatus,@RequestUserCity,@RequestUserCityName,@OprCityId,@OprCityName)");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
            db.AddInParameter(dbCommand, "HouseId", DbType.Guid, model.HouseId);
            db.AddInParameter(dbCommand, "HouseCode", DbType.AnsiString, model.HouseCode);
            db.AddInParameter(dbCommand, "HouseAddress", DbType.AnsiString, model.HouseAddress);
            db.AddInParameter(dbCommand, "ChangeType", DbType.Int32, model.ChangeType);
            db.AddInParameter(dbCommand, "HouseStatus", DbType.Int32, model.HouseStatus);
            db.AddInParameter(dbCommand, "OperatorId", DbType.Guid, model.OperatorId);
            db.AddInParameter(dbCommand, "Operator", DbType.AnsiString, model.Operator);
            db.AddInParameter(dbCommand, "OprDepartId", DbType.Guid, model.OprDepartId);
            db.AddInParameter(dbCommand, "OprDepart", DbType.AnsiString, model.OprDepart);
            db.AddInParameter(dbCommand, "CompanyId", DbType.Guid, model.CompanyId);
            db.AddInParameter(dbCommand, "CompanyName", DbType.AnsiString, model.CompanyName);
            db.AddInParameter(dbCommand, "RequestUserCode", DbType.AnsiString, model.RequestUserCode);
            db.AddInParameter(dbCommand, "RequestUserId", DbType.Guid, model.RequestUserId);
            db.AddInParameter(dbCommand, "RequestUser", DbType.AnsiString, model.RequestUser);
            db.AddInParameter(dbCommand, "RequestDepart", DbType.AnsiString, model.RequestDepart);
            db.AddInParameter(dbCommand, "RequestDepartId", DbType.Guid, model.RequestDepartId);
            db.AddInParameter(dbCommand, "Remarks", DbType.AnsiString, model.Remarks);
            db.AddInParameter(dbCommand, "ResonRemarks", DbType.AnsiString, model.ResonRemarks);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "Mobile", DbType.AnsiString, model.Mobile);
            db.AddInParameter(dbCommand, "Phone", DbType.AnsiString, model.Phone);
            db.AddInParameter(dbCommand, "confirmPersonName", DbType.AnsiString, model.confirmPersonName);
            db.AddInParameter(dbCommand, "confirmPersonId", DbType.Guid, model.confirmPersonId);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "Addtime", DbType.DateTime, model.Addtime);
            db.AddInParameter(dbCommand, "DealTime", DbType.DateTime, model.DealTime);
            db.AddInParameter(dbCommand, "oldUserId", DbType.Guid, model.oldUserId);
            db.AddInParameter(dbCommand, "oldUserName", DbType.AnsiString, model.oldUserName);
            db.AddInParameter(dbCommand, "oldDepart", DbType.AnsiString, model.oldDepart);
            db.AddInParameter(dbCommand, "oldDepartId", DbType.Guid, model.oldDepartId);
            db.AddInParameter(dbCommand, "oldCompanyId", DbType.Guid, model.oldCompanyId);
            db.AddInParameter(dbCommand, "oldCompanyName", DbType.AnsiString, model.oldCompanyName);
            db.AddInParameter(dbCommand, "oldCity", DbType.Guid, model.oldCity);
            db.AddInParameter(dbCommand, "oldCityName", DbType.AnsiString, model.oldCityName);
            db.AddInParameter(dbCommand, "oldHouseStatus", DbType.Int32, model.oldHouseStatus);
            db.AddInParameter(dbCommand, "RequestUserCity", DbType.Guid, model.RequestUserCity);
            db.AddInParameter(dbCommand, "RequestUserCityName", DbType.AnsiString, model.RequestUserCityName);
            db.AddInParameter(dbCommand, "OprCityId", DbType.Guid, model.OprCityId);
            db.AddInParameter(dbCommand, "OprCityName", DbType.AnsiString, model.OprCityName);
            db.ExecuteNonQuery(dbCommand);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static void Update(Chenxin.Lib.House.Entity.House_RequestChangeInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update House_RequestChangeInfo set ");
            strSql.Append("HouseId=@HouseId,");
            strSql.Append("HouseCode=@HouseCode,");
            strSql.Append("HouseAddress=@HouseAddress,");
            strSql.Append("ChangeType=@ChangeType,");
            strSql.Append("HouseStatus=@HouseStatus,");
            strSql.Append("OperatorId=@OperatorId,");
            strSql.Append("Operator=@Operator,");
            strSql.Append("OprDepartId=@OprDepartId,");
            strSql.Append("OprDepart=@OprDepart,");
            strSql.Append("CompanyId=@CompanyId,");
            strSql.Append("CompanyName=@CompanyName,");
            strSql.Append("RequestUserCode=@RequestUserCode,");
            strSql.Append("RequestUserId=@RequestUserId,");
            strSql.Append("RequestUser=@RequestUser,");
            strSql.Append("RequestDepart=@RequestDepart,");
            strSql.Append("RequestDepartId=@RequestDepartId,");
            strSql.Append("Remarks=@Remarks,");
            strSql.Append("ResonRemarks=@ResonRemarks,");
            strSql.Append("CustomerName=@CustomerName,");
            strSql.Append("Mobile=@Mobile,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("confirmPersonName=@confirmPersonName,");
            strSql.Append("confirmPersonId=@confirmPersonId,");
            strSql.Append("Status=@Status,");
            strSql.Append("Addtime=@Addtime,");
            strSql.Append("DealTime=@DealTime,");
            strSql.Append("oldUserId=@oldUserId,");
            strSql.Append("oldUserName=@oldUserName,");
            strSql.Append("oldDepart=@oldDepart,");
            strSql.Append("oldDepartId=@oldDepartId,");
            strSql.Append("oldCompanyId=@oldCompanyId,");
            strSql.Append("oldCompanyName=@oldCompanyName,");
            strSql.Append("oldCity=@oldCity,");
            strSql.Append("oldCityName=@oldCityName,");
            strSql.Append("oldHouseStatus=@oldHouseStatus,");
            strSql.Append("RequestUserCity=@RequestUserCity,");
            strSql.Append("RequestUserCityName=@RequestUserCityName,");
            strSql.Append("confirmDepartName=@confirmDepartName,");
            strSql.Append("confirmDepartId=@confirmDepartId,");
            strSql.Append("OprCityId=@OprCityId,");
            strSql.Append("OprCityName=@OprCityName");
            strSql.Append(" where RecordId=@RecordId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
            db.AddInParameter(dbCommand, "HouseId", DbType.Guid, model.HouseId);
            db.AddInParameter(dbCommand, "HouseCode", DbType.AnsiString, model.HouseCode);
            db.AddInParameter(dbCommand, "HouseAddress", DbType.AnsiString, model.HouseAddress);
            db.AddInParameter(dbCommand, "ChangeType", DbType.Int32, model.ChangeType);
            db.AddInParameter(dbCommand, "HouseStatus", DbType.Int32, model.HouseStatus);
            db.AddInParameter(dbCommand, "OperatorId", DbType.Guid, model.OperatorId);
            db.AddInParameter(dbCommand, "Operator", DbType.AnsiString, model.Operator);
            db.AddInParameter(dbCommand, "OprDepartId", DbType.Guid, model.OprDepartId);
            db.AddInParameter(dbCommand, "OprDepart", DbType.AnsiString, model.OprDepart);
            db.AddInParameter(dbCommand, "CompanyId", DbType.Guid, model.CompanyId);
            db.AddInParameter(dbCommand, "CompanyName", DbType.AnsiString, model.CompanyName);
            db.AddInParameter(dbCommand, "RequestUserCode", DbType.AnsiString, model.RequestUserCode);
            db.AddInParameter(dbCommand, "RequestUserId", DbType.Guid, model.RequestUserId);
            db.AddInParameter(dbCommand, "RequestUser", DbType.AnsiString, model.RequestUser);
            db.AddInParameter(dbCommand, "RequestDepart", DbType.AnsiString, model.RequestDepart);
            db.AddInParameter(dbCommand, "RequestDepartId", DbType.Guid, model.RequestDepartId);
            db.AddInParameter(dbCommand, "Remarks", DbType.AnsiString, model.Remarks);
            db.AddInParameter(dbCommand, "ResonRemarks", DbType.AnsiString, model.ResonRemarks);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "Mobile", DbType.AnsiString, model.Mobile);
            db.AddInParameter(dbCommand, "Phone", DbType.AnsiString, model.Phone);
            db.AddInParameter(dbCommand, "confirmPersonName", DbType.AnsiString, model.confirmPersonName);
            db.AddInParameter(dbCommand, "confirmPersonId", DbType.Guid, model.confirmPersonId);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "Addtime", DbType.DateTime, model.Addtime);
            db.AddInParameter(dbCommand, "DealTime", DbType.DateTime, model.DealTime);
            db.AddInParameter(dbCommand, "oldUserId", DbType.Guid, model.oldUserId);
            db.AddInParameter(dbCommand, "oldUserName", DbType.AnsiString, model.oldUserName);
            db.AddInParameter(dbCommand, "oldDepart", DbType.AnsiString, model.oldDepart);
            db.AddInParameter(dbCommand, "oldDepartId", DbType.Guid, model.oldDepartId);
            db.AddInParameter(dbCommand, "oldCompanyId", DbType.Guid, model.oldCompanyId);
            db.AddInParameter(dbCommand, "oldCompanyName", DbType.AnsiString, model.oldCompanyName);
            db.AddInParameter(dbCommand, "oldCity", DbType.Guid, model.oldCity);
            db.AddInParameter(dbCommand, "oldCityName", DbType.AnsiString, model.oldCityName);
            db.AddInParameter(dbCommand, "oldHouseStatus", DbType.Int32, model.oldHouseStatus);
            db.AddInParameter(dbCommand, "RequestUserCity", DbType.Guid, model.RequestUserCity);
            db.AddInParameter(dbCommand, "RequestUserCityName", DbType.AnsiString, model.RequestUserCityName);
            db.AddInParameter(dbCommand, "confirmDepartId", DbType.Guid, model.confirmDepartId);
            db.AddInParameter(dbCommand, "confirmDepartName", DbType.AnsiString, model.confirmDepartName);
            db.AddInParameter(dbCommand, "OprCityId", DbType.Guid, model.OprCityId);
            db.AddInParameter(dbCommand, "OprCityName", DbType.AnsiString, model.OprCityName);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static void Delete(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from House_RequestChangeInfo ");
            strSql.Append(" where RecordId=@RecordId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.House.Entity.House_RequestChangeInfo GetModel(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,HouseId,HouseCode,HouseAddress,ChangeType,HouseStatus,OperatorId,Operator,OprDepartId,OprDepart,CompanyId,CompanyName,RequestUserCode,RequestUserId,RequestUser,RequestDepart,RequestDepartId,Remarks,ResonRemarks,CustomerName,Mobile,Phone,confirmPersonName,confirmPersonId,Status,Addtime,DealTime,oldUserId,oldUserName,oldDepart,oldDepartId,oldCompanyId,oldCompanyName,oldCity,oldCityName,oldHouseStatus,RequestUserCity,RequestUserCityName,OprCityId,OprCityName from House_RequestChangeInfo ");
            strSql.Append(" where RecordId=@RecordId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
            Chenxin.Lib.House.Entity.House_RequestChangeInfo model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,HouseId,HouseCode,HouseAddress,ChangeType,HouseStatus,OperatorId,Operator,OprDepartId,OprDepart,CompanyId,CompanyName,RequestUserCode,RequestUserId,RequestUser,RequestDepart,RequestDepartId,Remarks,ResonRemarks,CustomerName,Mobile,Phone,confirmPersonName,confirmPersonId,Status,Addtime,DealTime,oldUserId,oldUserName,oldDepart,oldDepartId,oldCompanyId,oldCompanyName,oldCity,oldCityName,oldHouseStatus,RequestUserCity,RequestUserCityName,OprCityId,OprCityName ");
            strSql.Append(" FROM House_RequestChangeInfo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            return db.ExecuteDataSet(CommandType.Text, strSql.ToString());
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public static DataSet GetList(int PageIndex, int PageSize, String OrderField, string TableName, string StrWhere, string FieldList, string TableFieldList, bool DoCount)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House_Search");
            DbCommand dbCommand = db.GetStoredProcCommand("PagerMultiTable");
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "OrderField", DbType.AnsiString, OrderField);
            db.AddInParameter(dbCommand, "TableName", DbType.AnsiString, TableName);
            db.AddInParameter(dbCommand, "StrWhere", DbType.AnsiString, StrWhere);
            db.AddInParameter(dbCommand, "FieldList", DbType.AnsiString, FieldList);
            db.AddInParameter(dbCommand, "TableFieldList", DbType.AnsiString, TableFieldList);
            db.AddInParameter(dbCommand, "DoCount", DbType.Boolean, DoCount);
            return db.ExecuteDataSet(dbCommand);
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public static DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            DbCommand dbCommand = db.GetStoredProcCommand("UP_GetRecordByPage");
            db.AddInParameter(dbCommand, "tblName", DbType.AnsiString, "House_RequestChangeInfo");
            db.AddInParameter(dbCommand, "fldName", DbType.AnsiString, "ID");
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "IsReCount", DbType.Boolean, 0);
            db.AddInParameter(dbCommand, "OrderType", DbType.Boolean, 0);
            db.AddInParameter(dbCommand, "strWhere", DbType.AnsiString, strWhere);
            return db.ExecuteDataSet(dbCommand);
        }*/

        /// <summary>
        /// 获得数据列表（比DataSet效率高，推荐使用）
        /// </summary>
        public static List<Chenxin.Lib.House.Entity.House_RequestChangeInfo> GetListArray(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,HouseId,HouseCode,HouseAddress,ChangeType,HouseStatus,OperatorId,Operator,OprDepartId,OprDepart,CompanyId,CompanyName,RequestUserCode,RequestUserId,RequestUser,RequestDepart,RequestDepartId,Remarks,ResonRemarks,CustomerName,Mobile,Phone,confirmPersonName,confirmPersonId,Status,Addtime,DealTime,oldUserId,oldUserName,oldDepart,oldDepartId,oldCompanyId,oldCompanyName,oldCity,oldCityName,oldHouseStatus,RequestUserCity,RequestUserCityName,OprCityId,OprCityName ");
            strSql.Append(" FROM House_RequestChangeInfo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<Chenxin.Lib.House.Entity.House_RequestChangeInfo> list = new List<Chenxin.Lib.House.Entity.House_RequestChangeInfo>();
            Database db = DatabaseFactory.CreateDatabase("Chenxin_House");
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                while (dataReader.Read())
                {
                    list.Add(ReaderBind(dataReader));
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return list;
        }


        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public static Chenxin.Lib.House.Entity.House_RequestChangeInfo ReaderBind(IDataReader dataReader)
        {
            Chenxin.Lib.House.Entity.House_RequestChangeInfo model = new Chenxin.Lib.House.Entity.House_RequestChangeInfo();
            object ojb;
            ojb = dataReader["RecordId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RecordId = new Guid(ojb.ToString());
            }
            ojb = dataReader["HouseId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.HouseId = new Guid(ojb.ToString());
            }
            model.HouseCode = dataReader["HouseCode"].ToString();
            model.HouseAddress = dataReader["HouseAddress"].ToString();
            ojb = dataReader["ChangeType"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ChangeType = (int)ojb;
            }
            ojb = dataReader["HouseStatus"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.HouseStatus = (int)ojb;
            }
            ojb = dataReader["OperatorId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OperatorId = new Guid(ojb.ToString());
            }
            model.Operator = dataReader["Operator"].ToString();
            ojb = dataReader["OprDepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OprDepartId = new Guid(ojb.ToString());
            }
            model.OprDepart = dataReader["OprDepart"].ToString();
            ojb = dataReader["CompanyId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CompanyId = new Guid(ojb.ToString());
            }
            model.CompanyName = dataReader["CompanyName"].ToString();
            model.RequestUserCode = dataReader["RequestUserCode"].ToString();
            ojb = dataReader["RequestUserId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RequestUserId = new Guid(ojb.ToString());
            }
            model.RequestUser = dataReader["RequestUser"].ToString();
            model.RequestDepart = dataReader["RequestDepart"].ToString();
            ojb = dataReader["RequestDepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RequestDepartId = new Guid(ojb.ToString());
            }
            model.Remarks = dataReader["Remarks"].ToString();
            model.ResonRemarks = dataReader["ResonRemarks"].ToString();
            model.CustomerName = dataReader["CustomerName"].ToString();
            model.Mobile = dataReader["Mobile"].ToString();
            model.Phone = dataReader["Phone"].ToString();
            model.confirmPersonName = dataReader["confirmPersonName"].ToString();
            ojb = dataReader["confirmPersonId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.confirmPersonId = new Guid(ojb.ToString());
            }
            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = (int)ojb;
            }
            ojb = dataReader["Addtime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Addtime = (DateTime)ojb;
            }
            ojb = dataReader["DealTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DealTime = (DateTime)ojb;
            }
            ojb = dataReader["oldUserId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.oldUserId = new Guid(ojb.ToString());
            }
            model.oldUserName = dataReader["oldUserName"].ToString();
            model.oldDepart = dataReader["oldDepart"].ToString();
            ojb = dataReader["oldDepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.oldDepartId = new Guid(ojb.ToString());
            }
            ojb = dataReader["oldCompanyId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.oldCompanyId = new Guid(ojb.ToString());
            }
            model.oldCompanyName = dataReader["oldCompanyName"].ToString();
            ojb = dataReader["oldCity"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.oldCity = new Guid(ojb.ToString());
            }
            model.oldCityName = dataReader["oldCityName"].ToString();
            ojb = dataReader["oldHouseStatus"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.oldHouseStatus = (int)ojb;
            }
            ojb = dataReader["RequestUserCity"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RequestUserCity = new Guid(ojb.ToString());
            }
            model.RequestUserCityName = dataReader["RequestUserCityName"].ToString();
            ojb = dataReader["OprCityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OprCityId = new Guid(ojb.ToString());
            }
            model.OprCityName = dataReader["OprCityName"].ToString();
            return model;
        }

        #endregion  成员方法
    }
}

